'''
Created on 12.09.2009

@author: ankstoo
'''

from pygs.services.security.authorization import Authorization

class AuthorizationSimple(Authorization):
    '''
    classdocs
    '''
    
    def getUserId(self, token):
        data = self.persistence().loadTokenData(token)
        if not data:
            return None
        else:
            return data.userId
    
    def hasRights(self, token, right, rightObject):
        return True
    
    def checkTokenDataCorrect(self, tokenData):
        return True
    
    def getLogedIn(self, token):
        data = self.persistence().loadTokenData(token)
        return data <> None and self.checkTokenDataCorrect(data)